# -*- coding: utf-8 -*-
from sqlalchemy import BigInteger, Column, DateTime, Integer,Text,Boolean
from sqlalchemy.dialects.mysql import TEXT, TINYINT, VARCHAR
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class TCategory(Base):
    __tablename__ = 't_category'
    __table_args__ = {'comment': '文章分类表'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    name = Column(VARCHAR(50), comment='分类名称')

class TJudge(Base):
    __tablename__ = 't_judge'
    __table_args__ = {'comment': 'llm分析结果'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    post_id = Column(BigInteger, comment='内容id')
    anxiety_spread_score = Column(Integer, comment='散布焦虑评分')
    knowledge_density_score = Column(Integer, comment='知识密集程度评分')
    optimism_score = Column(Integer, comment='乐观程度评分')
    quality_score = Column(Integer, comment='质量评分')
    category = Column(VARCHAR(50), comment='类别')

class TLabel(Base):
    __tablename__ = 't_label'
    __table_args__ = {'comment': '文章标签表'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    name = Column(VARCHAR(50), comment='标签名称')
    ch_name = Column(VARCHAR(250), comment='中文标签名称')

class TMiddlePostLabel(Base):
    __tablename__ = 't_middle_post_label'
    __table_args__ = {'comment': '文章标签中间表'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    label_id = Column(BigInteger, comment='标签id')
    post_id = Column(BigInteger, comment='文章id')

class TPost(Base):
    __tablename__ = 't_post'
    __table_args__ = {'comment': '内容表'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    title = Column(VARCHAR(255), comment='标题')
    name = Column(VARCHAR(200), comment='名称')
    url = Column(VARCHAR(500), comment='链接地址')
    content = Column(Text, comment='内容')
    short_content = Column(VARCHAR(2000), comment='内容总结')
    is_judge = Column(Boolean, comment='是否经过评价')
    is_user_define = Column(Boolean, comment='是否用户定制')
    source_id = Column(BigInteger, comment='源id')
    content_date = Column(DateTime, comment='内容发表时间')
    category_id = Column(BigInteger, comment='类别id')
    stars = Column(Integer, comment='评分')
    ttl = Column(VARCHAR(255), comment='语音文件地址')

class TSource(Base):
    __tablename__ = 't_source'
    __table_args__ = {'comment': '内容源表'}

    id = Column(BigInteger, primary_key=True, autoincrement=True)
    create_by = Column(VARCHAR(50), comment='创建人')
    create_date = Column(DateTime, comment='创建时间')
    update_by = Column(VARCHAR(50), comment='更新人')
    update_date = Column(DateTime, comment='更新时间')
    delete_flag = Column(Integer, comment='数据状态 0可用 -1不可用')
    name = Column(VARCHAR(200), comment='名称')
    url = Column(VARCHAR(500), comment='链接地址')
    username = Column(VARCHAR(100), comment='用户')
    is_user_define = Column(Boolean, comment='是否用户定制')
